CC = gcc
CFLAGS = -ggdb -pedantic -Wextra -fstack-protector -D_FORTIFY_SOURCE=2 -fpack-struct -Wall -I/usr/local/include -I/usr/include -I./include  
#-march=amdfam10 -mtune=amdfam10  
LIBS = -L/usr/local/lib/mysql -lmysqlclient
# -lz -lcrypt -lnsl -lm

# uncomment the following line if compiling on a 64 bit machine
# BIT64 = -Dbit64

INSTALLSITEMAN1DIR = ${mandir}/man1
DISTMAN1DIR = docs/man
bindir = ${exec_prefix}/bin
datarootdir = ${prefix}/share
exec_prefix = ${prefix}
mandir = ${datarootdir}/man
prefix = /usr/local

TARGET = aurora

.PHONY: install

all:	$(TARGET)

$(TARGET): main.o comm.o 
	$(CC) $(LIBS) main.o comm.o -o $(TARGET)

main.o: main.c include/main.h include/comm.h include/names.h include/states.h 
	$(CC) $(LIBS) $(CFLAGS) ${BIT64} -c main.c

comm.o: comm.c include/main.h include/comm.h include/names.h include/states.h
	$(CC) $(LIBS) $(CFLAGS) ${BIT64} -c comm.c

clean:
	rm -f $(TARGET) *.o

install: aurora
	install -m 0700 $(TARGET) $(bindir)
	install -m 0644 ${DISTMAN1DIR}/$(TARGET).1 ${INSTALLSITEMAN1DIR}

uninstall:
	rm -f $(bindir)/$(TARGET) ${INSTALLSITEMAN1DIR}/$(TARGET).1
	

